package com.apply.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

/**
 * @author tianp
 * 报名信息 apply_info
 */
@Data
@Entity
@Table(name = "apply_info")
@ApiModel(value = "ApplyInfo", description = "报名信息对象")
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
@EntityListeners(AuditingEntityListener.class)
public class ApplyInfo {
    @Id
    @GeneratedValue
    @ApiModelProperty(value = "id", dataType = "long")
    private Long id;
    /**
     * 身份证号
     */
    @ApiModelProperty(value = "身份证号", dataType = "string")
    private String cartNum;
    /**
     * 报名id
     */
    @ApiModelProperty(value = "报名id", dataType = "string")
    private String applyId;
    /**
     * 真实姓名
     */
    @ApiModelProperty(value = "真实姓名", dataType = "string")
    private String realName;

    /**
     * 性别
     */
    @ApiModelProperty(value = "性别", dataType = "string")
    private String sex;

    /**
     * 头像路径
     */
    @ApiModelProperty(value = "头像路径", dataType = "string")
    private String photoPath;
    /**
     * 报名时间
     */
    private Date applyTime;

    /**
     * 用户账号
     */
    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "userJid")
    private SysUser sysUser;
    /**
     * 考试信息
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "examNum")
    private ExamInfo examInfo;
    @CreatedDate
    private Date createTime;
    @LastModifiedDate
    private Date modifiedTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCartNum() {
        return cartNum;
    }

    public void setCartNum(String cartNum) {
        this.cartNum = cartNum;
    }

    public String getApplyId() {
        return applyId;
    }

    public void setApplyId(String applyId) {
        this.applyId = applyId;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPhotoPath() {
        return photoPath;
    }

    public void setPhotoPath(String photoPath) {
        this.photoPath = photoPath;
    }

    public Date getApplyTime() {
        return applyTime;
    }

    public void setApplyTime(Date applyTime) {
        this.applyTime = applyTime;
    }

    public SysUser getSysUser() {
        return sysUser;
    }

    public void setSysUser(SysUser sysUser) {
        this.sysUser = sysUser;
    }

    public ExamInfo getExamInfo() {
        return examInfo;
    }

    public void setExamInfo(ExamInfo examInfo) {
        this.examInfo = examInfo;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifiedTime() {
        return modifiedTime;
    }

    public void setModifiedTime(Date modifiedTime) {
        this.modifiedTime = modifiedTime;
    }
}
